/* 管理后台布局样式 - 核心功能 */

/* 主容器 - 使用CSS Grid */
.admin-container {
    display: grid;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 侧边栏基础样式 */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 使用相同的动画曲线 */
    z-index: 40; /* 提高z-index，确保在最上层 */
    box-sizing: border-box;
}

/* 菜单项高度固定，避免跳动 */
.admin-sidebar .h-10 {
    height: 2.5rem !important; /* 40px */
    min-height: 2.5rem !important;
    max-height: 2.5rem !important;
}

/* 分组标题高度固定 */
.admin-sidebar .h-6 {
    height: 1.5rem !important; /* 24px */
    min-height: 1.5rem !important;
    max-height: 1.5rem !important;
}

/* 确保图标和文字不会压缩 */
.admin-sidebar .flex-shrink-0 {
    flex-shrink: 0 !important;
}

/* 主内容区域 - 使用绝对定位精确控制 */
.admin-main-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 使用相同的动画曲线 */
    overflow: hidden;
    box-sizing: border-box;
    z-index: 20; /* 设置合适的z-index */
}

/* 基础状态 - 小屏幕 */
.admin-main-content {
    left: 0px;
}

/* 大屏幕：默认展开状态 */
@media (min-width: 1024px) {
    .admin-main-content {
        left: 192px; /* 192px - w-48 */
    }
}

/* 中等屏幕：默认收窄状态 */
@media (min-width: 768px) and (max-width: 1023px) {
    .admin-main-content {
        left: 80px; /* 80px - w-20 */
    }
}

/* CSS类覆盖 - 使用最高优先级，确保覆盖媒体查询 */
.admin-main-content.sidebar-expanded {
    left: 192px !important; /* 192px - w-48 */
}

.admin-main-content.sidebar-collapsed {
    left: 80px !important; /* 80px - w-20 */
}

.admin-main-content.sidebar-hidden {
    left: 0px !important; /* 0px - 隐藏状态 */
}

/* 统一动画设置 - 确保侧边栏和内容区动画一致 */
.admin-sidebar,
.admin-main-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 侧边栏宽度动画 - 与内容区left动画同步 */
.admin-sidebar.w-48,
.admin-sidebar.w-20 {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 小屏幕特殊处理 */
@media (max-width: 767px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 192px !important; /* 小屏幕下固定宽度 */
        min-width: 192px !important;
        max-width: 192px !important;
    }

    /* 小屏幕下显示状态 */
    .admin-sidebar.translate-x-0 {
        transform: translateX(0) !important;
    }

    .admin-main-content {
        left: 0px !important;
    }
}

/* 强制覆盖所有可能的margin */
.admin-main-content,
.admin-main-content * {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 侧边栏宽度强制设置 - 使用最高优先级选择器 */
body .admin-sidebar.w-48,
html body .admin-sidebar.w-48,
.admin-sidebar.w-48 {
    width: 192px !important;
    min-width: 192px !important;
    max-width: 192px !important;
    flex: 0 0 192px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

body .admin-sidebar.w-20,
html body .admin-sidebar.w-20,
.admin-sidebar.w-20 {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    flex: 0 0 80px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* 强制侧边栏内容不超出宽度 */
.admin-sidebar * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* 确保侧边栏不会被压缩 */
.admin-sidebar {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

